/**
 * @author liangxi
 * @since 2023/12/21
 */

#ifndef DESIGNPATTERN_SIMPLEREMOTECONTROL_H
#define DESIGNPATTERN_SIMPLEREMOTECONTROL_H //防卫式声明

#include <memory>
#include "Command/Command.h"

namespace CommandSR {

    /**
     * 服务员
     */
    class SimpleRemoteControl {
    public:
        SimpleRemoteControl() = default;

        void setSlot(const std::shared_ptr<Command> &command) {
            SimpleRemoteControl::slot = command;
        }

        void buttonWasPressed() {
            slot->execute();
        }

    private:
        std::shared_ptr<Command> slot;

    };

} // CommandSR

#endif //DESIGNPATTERN_SIMPLEREMOTECONTROL_H
